package MiniZelda;

import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;

public class Render {
	
	Main main;
	BufferedImage buffer;
	
	
	//constructor
	public Render(Main main) {
		this.main = main;
		buffer = new BufferedImage(Constants.WIDTH, Constants.HEIGHT, BufferedImage.TYPE_INT_RGB);
	}
	
	//renders everything in buffer
	public void render(Intel i) {
		Graphics2D b = buffer.createGraphics();
		b.setColor(Color.black);
		b.fillRect(0, 0, Constants.WIDTH-1, Constants.HEIGHT-1);
		
		b.setColor(Color.red);
		b.fillRect(i.getX(), i.getY(), 25, 25);
		
		b.setColor(Color.white);
		b.drawString("This is text", 100, 100);
		b.dispose();
	}
	
	//displays buffer on the screen
	public void display() {
		Graphics2D g = (Graphics2D) main.game.getGraphics();
		g.drawImage(buffer, 0, 0, main.game);
		Toolkit.getDefaultToolkit().sync();
		g.dispose();
	}

}